package cn.oniokey.waterDetection.mapper;

import cn.oniokey.waterDetection.domain.Water;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WaterMapper extends BaseMapper<Water> {

    @Select("SELECT client_id, water_discharge, instantaneous_water_flow, water_level, create_time FROM water WHERE client_id = #{clientId} ORDER BY create_time DESC LIMIT 1")
    Water getNewWaterById(String clientId);

    @Select("SELECT client_id, water_discharge, instantaneous_water_flow, water_level, create_time FROM water WHERE client_id = #{clientId}")
    List<Water> getWaterById(String clientId);
}
